﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using System.Windows.Forms;
using HslCommunication.BasicFramework;

namespace HslCommunication.Controls
{
	/// <summary>
	/// 曲线控件对象
	/// </summary>
	/// <remarks>
	/// 详细参照如下的博客:
	/// </remarks>
	// Token: 0x02000171 RID: 369
	public class UserCurve : UserControl
	{
		/// <summary>
		/// 实例化一个曲线显示的控件
		/// </summary>
		// Token: 0x06001E5F RID: 7775 RVA: 0x00092218 File Offset: 0x00090418
		public UserCurve()
		{
			this.InitializeComponent();
			this.DoubleBuffered = true;
			this.random = new Random();
			this.data_list = new Dictionary<string, HslCurveItem>();
			this.auxiliary_lines = new List<AuxiliaryLine>();
			this.format_left = new StringFormat
			{
				LineAlignment = StringAlignment.Center,
				Alignment = StringAlignment.Near
			};
			this.format_right = new StringFormat
			{
				LineAlignment = StringAlignment.Center,
				Alignment = StringAlignment.Far
			};
			this.format_center = new StringFormat
			{
				LineAlignment = StringAlignment.Center,
				Alignment = StringAlignment.Center
			};
			this.font_size9 = new Font("宋体", 9f);
			this.font_size12 = new Font("宋体", 12f);
			this.InitializationColor();
			this.pen_dash = new Pen(this.color_deep);
			this.pen_dash.DashStyle = DashStyle.Custom;
			this.pen_dash.DashPattern = new float[]
			{
				5f,
				5f
			};
		}

		/// <summary>
		/// 获取或设置图形的纵坐标的最大值，该值必须大于最小值
		/// </summary>
		// Token: 0x17000638 RID: 1592
		// (get) Token: 0x06001E60 RID: 7776 RVA: 0x00092410 File Offset: 0x00090610
		// (set) Token: 0x06001E61 RID: 7777 RVA: 0x00092428 File Offset: 0x00090628
		[Category("外观")]
		[Description("获取或设置图形的左纵坐标的最大值，该值必须大于最小值")]
		[Browsable(true)]
		[DefaultValue(100f)]
		public float ValueMaxLeft
		{
			get
			{
				return this.value_max_left;
			}
			set
			{
				bool flag = value > this.value_min_left;
				if (flag)
				{
					this.value_max_left = value;
					base.Invalidate();
				}
			}
		}

		/// <summary>
		/// 获取或设置图形的纵坐标的最小值，该值必须小于最大值
		/// </summary>
		// Token: 0x17000639 RID: 1593
		// (get) Token: 0x06001E62 RID: 7778 RVA: 0x00092454 File Offset: 0x00090654
		// (set) Token: 0x06001E63 RID: 7779 RVA: 0x0009246C File Offset: 0x0009066C
		[Category("外观")]
		[Description("获取或设置图形的左纵坐标的最小值，该值必须小于最大值")]
		[Browsable(true)]
		[DefaultValue(0f)]
		public float ValueMinLeft
		{
			get
			{
				return this.value_min_left;
			}
			set
			{
				bool flag = value < this.value_max_left;
				if (flag)
				{
					this.value_min_left = value;
					base.Invalidate();
				}
			}
		}

		/// <summary>
		/// 获取或设置图形的纵坐标的最大值，该值必须大于最小值
		/// </summary>
		// Token: 0x1700063A RID: 1594
		// (get) Token: 0x06001E64 RID: 7780 RVA: 0x00092498 File Offset: 0x00090698
		// (set) Token: 0x06001E65 RID: 7781 RVA: 0x000924B0 File Offset: 0x000906B0
		[Category("外观")]
		[Description("获取或设置图形的右纵坐标的最大值，该值必须大于最小值")]
		[Browsable(true)]
		[DefaultValue(100f)]
		public float ValueMaxRight
		{
			get
			{
				return this.value_max_right;
			}
			set
			{
				bool flag = value > this.value_min_right;
				if (flag)
				{
					this.value_max_right = value;
					base.Invalidate();
				}
			}
		}

		/// <summary>
		/// 获取或设置图形的纵坐标的最小值，该值必须小于最大值
		/// </summary>
		// Token: 0x1700063B RID: 1595
		// (get) Token: 0x06001E66 RID: 7782 RVA: 0x000924DC File Offset: 0x000906DC
		// (set) Token: 0x06001E67 RID: 7783 RVA: 0x000924F4 File Offset: 0x000906F4
		[Category("外观")]
		[Description("获取或设置图形的右纵坐标的最小值，该值必须小于最大值")]
		[Browsable(true)]
		[DefaultValue(0f)]
		public float ValueMinRight
		{
			get
			{
				return this.value_min_right;
			}
			set
			{
				bool flag = value < this.value_max_right;
				if (flag)
				{
					this.value_min_right = value;
					base.Invalidate();
				}
			}
		}

		/// <summary>
		/// 获取或设置图形的纵轴分段数
		/// </summary>
		// Token: 0x1700063C RID: 1596
		// (get) Token: 0x06001E68 RID: 7784 RVA: 0x00092520 File Offset: 0x00090720
		// (set) Token: 0x06001E69 RID: 7785 RVA: 0x00092538 File Offset: 0x00090738
		[Category("外观")]
		[Description("获取或设置图形的纵轴分段数")]
		[Browsable(true)]
		[DefaultValue(5)]
		public int ValueSegment
		{
			get
			{
				return this.value_Segment;
			}
			set
			{
				this.value_Segment = value;
				base.Invalidate();
			}
		}

		/// <summary>
		/// 获取或设置所有的数据是否强制在一个界面里显示
		/// </summary>
		// Token: 0x1700063D RID: 1597
		// (get) Token: 0x06001E6A RID: 7786 RVA: 0x0009254C File Offset: 0x0009074C
		// (set) Token: 0x06001E6B RID: 7787 RVA: 0x00092564 File Offset: 0x00090764
		[Category("外观")]
		[Description("获取或设置所有的数据是否强制在一个界面里显示")]
		[Browsable(true)]
		[DefaultValue(false)]
		public bool IsAbscissaStrech
		{
			get
			{
				return this.value_IsAbscissaStrech;
			}
			set
			{
				this.value_IsAbscissaStrech = value;
				base.Invalidate();
			}
		}

		/// <summary>
		/// 获取或设置拉伸模式下的最大数据量
		/// </summary>
		// Token: 0x1700063E RID: 1598
		// (get) Token: 0x06001E6C RID: 7788 RVA: 0x00092578 File Offset: 0x00090778
		// (set) Token: 0x06001E6D RID: 7789 RVA: 0x00092590 File Offset: 0x00090790
		[Category("外观")]
		[Description("获取或设置拉伸模式下的最大数据量")]
		[Browsable(true)]
		[DefaultValue(300)]
		public int StrechDataCountMax
		{
			get
			{
				return this.value_StrechDataCountMax;
			}
			set
			{
				this.value_StrechDataCountMax = value;
				base.Invalidate();
			}
		}

		/// <summary>
		/// 获取或设置虚线是否进行显示
		/// </summary>
		// Token: 0x1700063F RID: 1599
		// (get) Token: 0x06001E6E RID: 7790 RVA: 0x000925A4 File Offset: 0x000907A4
		// (set) Token: 0x06001E6F RID: 7791 RVA: 0x000925BC File Offset: 0x000907BC
		[Category("外观")]
		[Description("获取或设置虚线是否进行显示")]
		[Browsable(true)]
		[DefaultValue(true)]
		public bool IsRenderDashLine
		{
			get
			{
				return this.value_IsRenderDashLine;
			}
			set
			{
				this.value_IsRenderDashLine = value;
				base.Invalidate();
			}
		}

		/// <summary>
		/// 获取或设置坐标轴及相关信息文本的颜色
		/// </summary>
		// Token: 0x17000640 RID: 1600
		// (get) Token: 0x06001E70 RID: 7792 RVA: 0x000925D0 File Offset: 0x000907D0
		// (set) Token: 0x06001E71 RID: 7793 RVA: 0x000925E8 File Offset: 0x000907E8
		[Category("外观")]
		[Description("获取或设置坐标轴及相关信息文本的颜色")]
		[Browsable(true)]
		[DefaultValue(typeof(Color), "DimGray")]
		public Color ColorLinesAndText
		{
			get
			{
				return this.color_deep;
			}
			set
			{
				this.color_deep = value;
				this.InitializationColor();
				base.Invalidate();
			}
		}

		/// <summary>
		/// 获取或设置虚线的颜色
		/// </summary>
		// Token: 0x17000641 RID: 1601
		// (get) Token: 0x06001E72 RID: 7794 RVA: 0x00092600 File Offset: 0x00090800
		// (set) Token: 0x06001E73 RID: 7795 RVA: 0x00092618 File Offset: 0x00090818
		[Category("外观")]
		[Description("获取或设置虚线的颜色")]
		[Browsable(true)]
		[DefaultValue(typeof(Color), "Gray")]
		public Color ColorDashLines
		{
			get
			{
				return this.color_dash;
			}
			set
			{
				this.color_dash = value;
				Pen pen = this.pen_dash;
				if (pen != null)
				{
					pen.Dispose();
				}
				this.pen_dash = new Pen(this.color_dash);
				this.pen_dash.DashStyle = DashStyle.Custom;
				this.pen_dash.DashPattern = new float[]
				{
					5f,
					5f
				};
				base.Invalidate();
			}
		}

		/// <summary>
		/// 获取或设置纵向虚线的分隔情况，单位为多少个数据
		/// </summary>
		// Token: 0x17000642 RID: 1602
		// (get) Token: 0x06001E74 RID: 7796 RVA: 0x00092688 File Offset: 0x00090888
		// (set) Token: 0x06001E75 RID: 7797 RVA: 0x000926A0 File Offset: 0x000908A0
		[Category("外观")]
		[Description("获取或设置纵向虚线的分隔情况，单位为多少个数据")]
		[Browsable(true)]
		[DefaultValue(100)]
		public int IntervalAbscissaText
		{
			get
			{
				return this.value_IntervalAbscissaText;
			}
			set
			{
				this.value_IntervalAbscissaText = value;
				base.Invalidate();
			}
		}

		/// <summary>
		/// 获取或设置实时数据新增时文本相对应于时间的格式化字符串，默认HH:mm
		/// </summary>
		// Token: 0x17000643 RID: 1603
		// (get) Token: 0x06001E76 RID: 7798 RVA: 0x000926B4 File Offset: 0x000908B4
		// (set) Token: 0x06001E77 RID: 7799 RVA: 0x000926CC File Offset: 0x000908CC
		[Category("外观")]
		[Description("获取或设置实时数据新增时文本相对应于时间的格式化字符串，默认HH:mm")]
		[Browsable(true)]
		[DefaultValue("HH:mm")]
		public string TextAddFormat
		{
			get
			{
				return this.textFormat;
			}
			set
			{
				this.textFormat = value;
				base.Invalidate();
			}
		}

		/// <summary>
		/// 获取或设置图标的标题信息
		/// </summary>
		// Token: 0x17000644 RID: 1604
		// (get) Token: 0x06001E78 RID: 7800 RVA: 0x000926E0 File Offset: 0x000908E0
		// (set) Token: 0x06001E79 RID: 7801 RVA: 0x000926F8 File Offset: 0x000908F8
		[Category("外观")]
		[Description("获取或设置图标的标题信息")]
		[Browsable(true)]
		[DefaultValue("")]
		public string Title
		{
			get
			{
				return this.value_title;
			}
			set
			{
				this.value_title = value;
				base.Invalidate();
			}
		}

		// Token: 0x06001E7A RID: 7802 RVA: 0x0009270C File Offset: 0x0009090C
		private void InitializationColor()
		{
			Pen pen = this.pen_normal;
			if (pen != null)
			{
				pen.Dispose();
			}
			Brush brush = this.brush_deep;
			if (brush != null)
			{
				brush.Dispose();
			}
			this.pen_normal = new Pen(this.color_deep);
			this.brush_deep = new SolidBrush(this.color_deep);
		}

		/// <summary>
		/// 设置曲线的横坐标文本，适用于显示一些固定的曲线信息
		/// </summary>
		/// <param name="descriptions">应该和曲线的点数一致</param>
		// Token: 0x06001E7B RID: 7803 RVA: 0x00092760 File Offset: 0x00090960
		public void SetCurveText(string[] descriptions)
		{
			this.data_text = descriptions;
			base.Invalidate();
		}

		/// <summary>
		/// 新增或修改一条指定关键字的左参考系曲线数据，需要指定数据，颜色随机，没有数据上限，线条宽度为1
		/// </summary>
		/// <param name="key">曲线关键字</param>
		/// <param name="data">曲线的具体数据</param>
		// Token: 0x06001E7C RID: 7804 RVA: 0x00092774 File Offset: 0x00090974
		public void SetLeftCurve(string key, float[] data)
		{
			this.SetLeftCurve(key, data, Color.FromArgb(this.random.Next(256), this.random.Next(256), this.random.Next(256)));
		}

		/// <summary>
		/// 新增或修改一条指定关键字的左参考系曲线数据，需要指定数据，颜色，没有数据上限，线条宽度为1
		/// </summary>
		/// <param name="key">曲线关键字</param>
		/// <param name="data"></param>
		/// <param name="lineColor"></param>
		// Token: 0x06001E7D RID: 7805 RVA: 0x000927C0 File Offset: 0x000909C0
		public void SetLeftCurve(string key, float[] data, Color lineColor)
		{
			this.SetCurve(key, true, data, lineColor, 1f);
		}

		/// <summary>
		/// 新增或修改一条指定关键字的右参考系曲线数据，需要指定数据，颜色随机，没有数据上限，线条宽度为1
		/// </summary>
		/// <param name="key">曲线关键字</param>
		/// <param name="data"></param>
		// Token: 0x06001E7E RID: 7806 RVA: 0x000927D4 File Offset: 0x000909D4
		public void SetRightCurve(string key, float[] data)
		{
			this.SetRightCurve(key, data, Color.FromArgb(this.random.Next(256), this.random.Next(256), this.random.Next(256)));
		}

		/// <summary>
		/// 新增或修改一条指定关键字的右参考系曲线数据，需要指定数据，颜色，没有数据上限，线条宽度为1
		/// </summary>
		/// <param name="key">曲线关键字</param>
		/// <param name="data"></param>
		/// <param name="lineColor"></param>
		// Token: 0x06001E7F RID: 7807 RVA: 0x00092820 File Offset: 0x00090A20
		public void SetRightCurve(string key, float[] data, Color lineColor)
		{
			this.SetCurve(key, false, data, lineColor, 1f);
		}

		/// <summary>
		/// 新增或修改一条指定关键字的曲线数据，需要指定参考系及数据，颜色，线条宽度
		/// </summary>
		/// <param name="key">曲线关键字</param>
		/// <param name="isLeft">是否以左侧坐标轴为参照系</param>
		/// <param name="data">数据</param>
		/// <param name="lineColor">线条颜色</param>
		/// <param name="thickness">线条宽度</param>
		// Token: 0x06001E80 RID: 7808 RVA: 0x00092834 File Offset: 0x00090A34
		public void SetCurve(string key, bool isLeft, float[] data, Color lineColor, float thickness)
		{
			bool flag = this.data_list.ContainsKey(key);
			if (flag)
			{
				bool flag2 = data == null;
				if (flag2)
				{
					data = new float[0];
				}
				this.data_list[key].Data = data;
			}
			else
			{
				bool flag3 = data == null;
				if (flag3)
				{
					data = new float[0];
				}
				this.data_list.Add(key, new HslCurveItem
				{
					Data = data,
					LineThickness = thickness,
					LineColor = lineColor,
					IsLeftFrame = isLeft
				});
				bool flag4 = this.data_text == null;
				if (flag4)
				{
					this.data_text = new string[data.Length];
				}
			}
			base.Invalidate();
		}

		/// <summary>
		/// 移除指定关键字的曲线
		/// </summary>
		/// <param name="key">曲线关键字</param>
		// Token: 0x06001E81 RID: 7809 RVA: 0x000928E0 File Offset: 0x00090AE0
		public void RemoveCurve(string key)
		{
			bool flag = this.data_list.ContainsKey(key);
			if (flag)
			{
				this.data_list.Remove(key);
			}
			bool flag2 = this.data_list.Count == 0;
			if (flag2)
			{
				this.data_text = new string[0];
			}
			base.Invalidate();
		}

		/// <summary>
		/// 移除指定关键字的曲线
		/// </summary>
		// Token: 0x06001E82 RID: 7810 RVA: 0x00092934 File Offset: 0x00090B34
		public void RemoveAllCurve()
		{
			int count = this.data_list.Count;
			this.data_list.Clear();
			bool flag = this.data_list.Count == 0;
			if (flag)
			{
				this.data_text = new string[0];
			}
			bool flag2 = count > 0;
			if (flag2)
			{
				base.Invalidate();
			}
		}

		/// <summary>
		/// 新增指定关键字曲线的一个数据，注意该关键字的曲线必须存在，否则无效
		/// </summary>
		/// <param name="key">新增曲线的关键字</param>
		/// <param name="values"></param>
		/// <param name="isUpdateUI">是否刷新界面</param>
		// Token: 0x06001E83 RID: 7811 RVA: 0x00092988 File Offset: 0x00090B88
		private void AddCurveData(string key, float[] values, bool isUpdateUI)
		{
			bool flag = values != null && values.Length < 1;
			if (!flag)
			{
				bool flag2 = this.data_list.ContainsKey(key);
				if (flag2)
				{
					HslCurveItem hslCurveItem = this.data_list[key];
					bool flag3 = hslCurveItem.Data != null;
					if (flag3)
					{
						bool flag4 = this.value_IsAbscissaStrech;
						if (flag4)
						{
							SoftBasic.AddArrayData<float>(ref hslCurveItem.Data, values, this.value_StrechDataCountMax);
						}
						else
						{
							SoftBasic.AddArrayData<float>(ref hslCurveItem.Data, values, 2048);
						}
						if (isUpdateUI)
						{
							base.Invalidate();
						}
					}
				}
			}
		}

		// Token: 0x06001E84 RID: 7812 RVA: 0x00092A1C File Offset: 0x00090C1C
		private void AddCurveTime(int count)
		{
			bool flag = this.data_text == null;
			if (!flag)
			{
				string[] array = new string[count];
				for (int i = 0; i < array.Length; i++)
				{
					array[i] = DateTime.Now.ToString(this.textFormat);
				}
				bool flag2 = this.value_IsAbscissaStrech;
				if (flag2)
				{
					SoftBasic.AddArrayData<string>(ref this.data_text, array, this.value_StrechDataCountMax);
				}
				else
				{
					SoftBasic.AddArrayData<string>(ref this.data_text, array, 2048);
				}
			}
		}

		/// <summary>
		/// 新增指定关键字曲线的一个数据，注意该关键字的曲线必须存在，否则无效
		/// </summary>
		/// <param name="key">曲线的关键字</param>
		/// <param name="value">数据值</param>
		// Token: 0x06001E85 RID: 7813 RVA: 0x00092AA3 File Offset: 0x00090CA3
		public void AddCurveData(string key, float value)
		{
			this.AddCurveData(key, new float[]
			{
				value
			});
		}

		/// <summary>
		/// 新增指定关键字曲线的一组数据，注意该关键字的曲线必须存在，否则无效
		/// </summary>
		/// <param name="key">曲线的关键字</param>
		/// <param name="values">数组值</param>
		// Token: 0x06001E86 RID: 7814 RVA: 0x00092AB8 File Offset: 0x00090CB8
		public void AddCurveData(string key, float[] values)
		{
			this.AddCurveData(key, values, false);
			bool flag = values != null && values.Length != 0;
			if (flag)
			{
				this.AddCurveTime(values.Length);
			}
			base.Invalidate();
		}

		/// <summary>
		/// 新增指定关键字数组曲线的一组数据，注意该关键字的曲线必须存在，否则无效，一个数据对应一个数组
		/// </summary>
		/// <param name="keys">曲线的关键字数组</param>
		/// <param name="values">数组值</param>
		// Token: 0x06001E87 RID: 7815 RVA: 0x00092AF4 File Offset: 0x00090CF4
		public void AddCurveData(string[] keys, float[] values)
		{
			bool flag = keys == null;
			if (flag)
			{
				throw new ArgumentNullException("keys");
			}
			bool flag2 = values == null;
			if (flag2)
			{
				throw new ArgumentNullException("values");
			}
			bool flag3 = keys.Length != values.Length;
			if (flag3)
			{
				throw new Exception("两个参数的数组长度不一致。");
			}
			for (int i = 0; i < keys.Length; i++)
			{
				this.AddCurveData(keys[i], new float[]
				{
					values[i]
				}, false);
			}
			this.AddCurveTime(1);
			base.Invalidate();
		}

		/// <summary>
		/// 设置一条曲线是否是可见的，如果该曲线不存在，则无效。
		/// </summary>
		/// <param name="key">关键字</param>
		/// <param name="visible">是否可见</param>
		// Token: 0x06001E88 RID: 7816 RVA: 0x00092B80 File Offset: 0x00090D80
		public void SetCurveVisible(string key, bool visible)
		{
			bool flag = this.data_list.ContainsKey(key);
			if (flag)
			{
				HslCurveItem hslCurveItem = this.data_list[key];
				hslCurveItem.Visible = visible;
				base.Invalidate();
			}
		}

		/// <summary>
		/// 设置多条曲线是否是可见的，如果该曲线不存在，则无效。
		/// </summary>
		/// <param name="keys">关键字</param>
		/// <param name="visible">是否可见</param>
		// Token: 0x06001E89 RID: 7817 RVA: 0x00092BBC File Offset: 0x00090DBC
		public void SetCurveVisible(string[] keys, bool visible)
		{
			foreach (string key in keys)
			{
				bool flag = this.data_list.ContainsKey(key);
				if (flag)
				{
					HslCurveItem hslCurveItem = this.data_list[key];
					hslCurveItem.Visible = visible;
				}
			}
			base.Invalidate();
		}

		/// <summary>
		/// 新增一条左侧的辅助线，使用默认的文本颜色
		/// </summary>
		/// <param name="value">数据值</param>
		// Token: 0x06001E8A RID: 7818 RVA: 0x00092C11 File Offset: 0x00090E11
		public void AddLeftAuxiliary(float value)
		{
			this.AddLeftAuxiliary(value, this.ColorLinesAndText);
		}

		/// <summary>
		/// 新增一条左侧的辅助线，使用指定的颜色
		/// </summary>
		/// <param name="value">数据值</param>
		/// <param name="lineColor">线条颜色</param>
		// Token: 0x06001E8B RID: 7819 RVA: 0x00092C22 File Offset: 0x00090E22
		public void AddLeftAuxiliary(float value, Color lineColor)
		{
			this.AddLeftAuxiliary(value, lineColor, 1f);
		}

		/// <summary>
		/// 新增一条左侧的辅助线
		/// </summary>
		/// <param name="value">数据值</param>
		/// <param name="lineColor">线条颜色</param>
		/// <param name="lineThickness">线条宽度</param>
		// Token: 0x06001E8C RID: 7820 RVA: 0x00092C33 File Offset: 0x00090E33
		public void AddLeftAuxiliary(float value, Color lineColor, float lineThickness)
		{
			this.AddAuxiliary(value, lineColor, lineThickness, true);
		}

		/// <summary>
		/// 新增一条右侧的辅助线，使用默认的文本颜色
		/// </summary>
		/// <param name="value">数据值</param>
		// Token: 0x06001E8D RID: 7821 RVA: 0x00092C41 File Offset: 0x00090E41
		public void AddRightAuxiliary(float value)
		{
			this.AddRightAuxiliary(value, this.ColorLinesAndText);
		}

		/// <summary>
		/// 新增一条右侧的辅助线，使用指定的颜色
		/// </summary>
		/// <param name="value">数据值</param>
		/// <param name="lineColor">线条颜色</param>
		// Token: 0x06001E8E RID: 7822 RVA: 0x00092C52 File Offset: 0x00090E52
		public void AddRightAuxiliary(float value, Color lineColor)
		{
			this.AddRightAuxiliary(value, lineColor, 1f);
		}

		/// <summary>
		/// 新增一条右侧的辅助线
		/// </summary>
		/// <param name="value">数据值</param>
		/// <param name="lineColor">线条颜色</param>
		/// <param name="lineThickness">线条宽度</param>
		// Token: 0x06001E8F RID: 7823 RVA: 0x00092C63 File Offset: 0x00090E63
		public void AddRightAuxiliary(float value, Color lineColor, float lineThickness)
		{
			this.AddAuxiliary(value, lineColor, lineThickness, false);
		}

		// Token: 0x06001E90 RID: 7824 RVA: 0x00092C74 File Offset: 0x00090E74
		private void AddAuxiliary(float value, Color lineColor, float lineThickness, bool isLeft)
		{
			this.auxiliary_lines.Add(new AuxiliaryLine
			{
				Value = value,
				LineColor = lineColor,
				PenDash = new Pen(lineColor)
				{
					DashStyle = DashStyle.Custom,
					DashPattern = new float[]
					{
						5f,
						5f
					}
				},
				IsLeftFrame = isLeft,
				LineThickness = lineThickness,
				LineTextBrush = new SolidBrush(lineColor)
			});
			base.Invalidate();
		}

		/// <summary>
		/// 移除所有的指定值的辅助曲线，包括左边的和右边的
		/// </summary>
		/// <param name="value"></param>
		// Token: 0x06001E91 RID: 7825 RVA: 0x00092D00 File Offset: 0x00090F00
		public void RemoveAuxiliary(float value)
		{
			int num = 0;
			for (int i = this.auxiliary_lines.Count - 1; i >= 0; i--)
			{
				bool flag = this.auxiliary_lines[i].Value == value;
				if (flag)
				{
					this.auxiliary_lines[i].Dispose();
					this.auxiliary_lines.RemoveAt(i);
					num++;
				}
			}
			bool flag2 = num > 0;
			if (flag2)
			{
				base.Invalidate();
			}
		}

		/// <summary>
		/// 移除所有的辅助线
		/// </summary>
		// Token: 0x06001E92 RID: 7826 RVA: 0x00092D80 File Offset: 0x00090F80
		public void RemoveAllAuxiliary()
		{
			int count = this.auxiliary_lines.Count;
			this.auxiliary_lines.Clear();
			bool flag = count > 0;
			if (flag)
			{
				base.Invalidate();
			}
		}

		// Token: 0x06001E93 RID: 7827 RVA: 0x00092DB8 File Offset: 0x00090FB8
		private void UserCurve_Paint(object sender, PaintEventArgs e)
		{
			bool flag = !Authorization.nzugaydgwadawdibbas();
			if (!flag)
			{
				Graphics graphics = e.Graphics;
				graphics.SmoothingMode = SmoothingMode.HighQuality;
				graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
				bool flag2 = this.BackColor != Color.Transparent;
				if (flag2)
				{
					graphics.Clear(this.BackColor);
				}
				int width = base.Width;
				int height = base.Height;
				bool flag3 = width < 120 || height < 60;
				if (!flag3)
				{
					graphics.DrawLines(this.pen_normal, new Point[]
					{
						new Point(this.leftRight - 1, this.upDowm - 8),
						new Point(this.leftRight - 1, height - this.upDowm),
						new Point(width - this.leftRight, height - this.upDowm),
						new Point(width - this.leftRight, this.upDowm - 8)
					});
					bool flag4 = !string.IsNullOrEmpty(this.value_title);
					if (flag4)
					{
						graphics.DrawString(this.value_title, this.font_size9, this.brush_deep, new Rectangle(0, 0, width - 1, 20), this.format_center);
					}
					SoftPainting.PaintTriangle(graphics, this.brush_deep, new Point(this.leftRight - 1, this.upDowm - 8), 4, GraphDirection.Upward);
					SoftPainting.PaintTriangle(graphics, this.brush_deep, new Point(width - this.leftRight, this.upDowm - 8), 4, GraphDirection.Upward);
					for (int i = 0; i < this.auxiliary_lines.Count; i++)
					{
						bool isLeftFrame = this.auxiliary_lines[i].IsLeftFrame;
						if (isLeftFrame)
						{
							this.auxiliary_lines[i].PaintValue = SoftPainting.ComputePaintLocationY(this.value_max_left, this.value_min_left, height - this.upDowm - this.upDowm, this.auxiliary_lines[i].Value) + (float)this.upDowm;
						}
						else
						{
							this.auxiliary_lines[i].PaintValue = SoftPainting.ComputePaintLocationY(this.value_max_right, this.value_min_right, height - this.upDowm - this.upDowm, this.auxiliary_lines[i].Value) + (float)this.upDowm;
						}
					}
					for (int j = 0; j <= this.value_Segment; j++)
					{
						float value = (float)j * (this.value_max_left - this.value_min_left) / (float)this.value_Segment + this.value_min_left;
						float num = SoftPainting.ComputePaintLocationY(this.value_max_left, this.value_min_left, height - this.upDowm - this.upDowm, value) + (float)this.upDowm;
						bool flag5 = this.IsNeedPaintDash(num);
						if (flag5)
						{
							graphics.DrawLine(this.pen_normal, (float)(this.leftRight - 4), num, (float)(this.leftRight - 1), num);
							RectangleF layoutRectangle = new RectangleF(0f, num - 9f, (float)(this.leftRight - 4), 20f);
							graphics.DrawString(value.ToString(), this.font_size9, this.brush_deep, layoutRectangle, this.format_right);
							float num2 = (float)j * (this.value_max_right - this.value_min_right) / (float)this.value_Segment + this.value_min_right;
							graphics.DrawLine(this.pen_normal, (float)(width - this.leftRight + 1), num, (float)(width - this.leftRight + 4), num);
							layoutRectangle.Location = new PointF((float)(width - this.leftRight + 4), num - 9f);
							graphics.DrawString(num2.ToString(), this.font_size9, this.brush_deep, layoutRectangle, this.format_left);
							bool flag6 = j > 0 && this.value_IsRenderDashLine;
							if (flag6)
							{
								graphics.DrawLine(this.pen_dash, (float)this.leftRight, num, (float)(width - this.leftRight), num);
							}
						}
					}
					bool flag7 = this.value_IsRenderDashLine;
					if (flag7)
					{
						bool flag8 = this.value_IsAbscissaStrech;
						if (flag8)
						{
							float num3 = (float)(width - this.leftRight * 2) * 1f / (float)(this.value_StrechDataCountMax - 1);
							int num4 = this.CalculateDataCountByOffect(num3);
							for (int k = 0; k < this.value_StrechDataCountMax; k += num4)
							{
								bool flag9 = k > 0 && k < this.value_StrechDataCountMax - 1;
								if (flag9)
								{
									graphics.DrawLine(this.pen_dash, (float)k * num3 + (float)this.leftRight, (float)this.upDowm, (float)k * num3 + (float)this.leftRight, (float)(height - this.upDowm - 1));
								}
								bool flag10 = this.data_text != null;
								if (flag10)
								{
									bool flag11 = k < this.data_text.Length && (float)k * num3 + (float)this.leftRight < (float)(this.data_text.Length - 1) * num3 + (float)this.leftRight - 40f;
									if (flag11)
									{
										Rectangle r = new Rectangle((int)((float)k * num3), height - this.upDowm + 1, 100, this.upDowm);
										graphics.DrawString(this.data_text[k], this.font_size9, this.brush_deep, r, this.format_center);
									}
								}
							}
							string[] array = this.data_text;
							bool flag12 = array != null && array.Length > 1;
							if (flag12)
							{
								bool flag13 = this.data_text.Length < this.value_StrechDataCountMax;
								if (flag13)
								{
									graphics.DrawLine(this.pen_dash, (float)(this.data_text.Length - 1) * num3 + (float)this.leftRight, (float)this.upDowm, (float)(this.data_text.Length - 1) * num3 + (float)this.leftRight, (float)(height - this.upDowm - 1));
								}
								Rectangle r2 = new Rectangle((int)((float)(this.data_text.Length - 1) * num3 + (float)this.leftRight) - this.leftRight, height - this.upDowm + 1, 100, this.upDowm);
								graphics.DrawString(this.data_text[this.data_text.Length - 1], this.font_size9, this.brush_deep, r2, this.format_center);
							}
						}
						else
						{
							int num5 = width - 2 * this.leftRight + 1;
							for (int l = this.leftRight; l < width - this.leftRight; l += this.value_IntervalAbscissaText)
							{
								bool flag14 = l != this.leftRight;
								if (flag14)
								{
									graphics.DrawLine(this.pen_dash, l, this.upDowm, l, height - this.upDowm - 1);
								}
								bool flag15 = this.data_text != null;
								if (flag15)
								{
									int num6 = (num5 > this.data_text.Length) ? this.data_text.Length : num5;
									bool flag16 = l - this.leftRight < this.data_text.Length;
									if (flag16)
									{
										bool flag17 = num6 - (l - this.leftRight) > 40;
										if (flag17)
										{
											bool flag18 = this.data_text.Length <= num5;
											if (flag18)
											{
												Rectangle r3 = new Rectangle(l - this.leftRight, height - this.upDowm + 1, 100, this.upDowm);
												graphics.DrawString(this.data_text[l - this.leftRight], this.font_size9, this.brush_deep, r3, this.format_center);
											}
											else
											{
												Rectangle r4 = new Rectangle(l - this.leftRight, height - this.upDowm + 1, 100, this.upDowm);
												graphics.DrawString(this.data_text[l - this.leftRight + this.data_text.Length - num5], this.font_size9, this.brush_deep, r4, this.format_center);
											}
										}
									}
								}
							}
							string[] array2 = this.data_text;
							bool flag19 = array2 != null && array2.Length > 1;
							if (flag19)
							{
								bool flag20 = this.data_text.Length < num5;
								if (flag20)
								{
									graphics.DrawLine(this.pen_dash, this.data_text.Length + this.leftRight - 1, this.upDowm, this.data_text.Length + this.leftRight - 1, height - this.upDowm - 1);
									Rectangle r5 = new Rectangle(this.data_text.Length + this.leftRight - 1 - this.leftRight, height - this.upDowm + 1, 100, this.upDowm);
									graphics.DrawString(this.data_text[this.data_text.Length - 1], this.font_size9, this.brush_deep, r5, this.format_center);
								}
								else
								{
									Rectangle r6 = new Rectangle(width - this.leftRight - this.leftRight, height - this.upDowm + 1, 100, this.upDowm);
									graphics.DrawString(this.data_text[this.data_text.Length - 1], this.font_size9, this.brush_deep, r6, this.format_center);
								}
							}
						}
					}
					for (int m = 0; m < this.auxiliary_lines.Count; m++)
					{
						bool isLeftFrame2 = this.auxiliary_lines[m].IsLeftFrame;
						if (isLeftFrame2)
						{
							graphics.DrawLine(this.auxiliary_lines[m].PenDash, (float)(this.leftRight - 4), this.auxiliary_lines[m].PaintValue, (float)(this.leftRight - 1), this.auxiliary_lines[m].PaintValue);
							RectangleF layoutRectangle2 = new RectangleF(0f, this.auxiliary_lines[m].PaintValue - 9f, (float)(this.leftRight - 4), 20f);
							graphics.DrawString(this.auxiliary_lines[m].Value.ToString(), this.font_size9, this.auxiliary_lines[m].LineTextBrush, layoutRectangle2, this.format_right);
						}
						else
						{
							graphics.DrawLine(this.auxiliary_lines[m].PenDash, (float)(width - this.leftRight + 1), this.auxiliary_lines[m].PaintValue, (float)(width - this.leftRight + 4), this.auxiliary_lines[m].PaintValue);
							RectangleF layoutRectangle3 = new RectangleF((float)(width - this.leftRight + 4), this.auxiliary_lines[m].PaintValue - 9f, (float)(this.leftRight - 4), 20f);
							graphics.DrawString(this.auxiliary_lines[m].Value.ToString(), this.font_size9, this.auxiliary_lines[m].LineTextBrush, layoutRectangle3, this.format_left);
						}
						graphics.DrawLine(this.auxiliary_lines[m].PenDash, (float)this.leftRight, this.auxiliary_lines[m].PaintValue, (float)(width - this.leftRight), this.auxiliary_lines[m].PaintValue);
					}
					bool flag21 = this.value_IsAbscissaStrech;
					if (flag21)
					{
						foreach (HslCurveItem hslCurveItem in this.data_list.Values)
						{
							bool flag22 = !hslCurveItem.Visible;
							if (!flag22)
							{
								float[] data = hslCurveItem.Data;
								bool flag23 = data != null && data.Length > 1;
								if (flag23)
								{
									float num7 = (float)(width - this.leftRight * 2) * 1f / (float)(this.value_StrechDataCountMax - 1);
									PointF[] array3 = new PointF[hslCurveItem.Data.Length];
									for (int n = 0; n < hslCurveItem.Data.Length; n++)
									{
										array3[n].X = (float)this.leftRight + (float)n * num7;
										array3[n].Y = SoftPainting.ComputePaintLocationY(hslCurveItem.IsLeftFrame ? this.value_max_left : this.value_max_right, hslCurveItem.IsLeftFrame ? this.value_min_left : this.value_min_right, height - this.upDowm - this.upDowm, hslCurveItem.Data[n]) + (float)this.upDowm;
									}
									using (Pen pen = new Pen(hslCurveItem.LineColor, hslCurveItem.LineThickness))
									{
										graphics.DrawLines(pen, array3);
									}
								}
							}
						}
					}
					else
					{
						foreach (HslCurveItem hslCurveItem2 in this.data_list.Values)
						{
							bool flag24 = !hslCurveItem2.Visible;
							if (!flag24)
							{
								float[] data2 = hslCurveItem2.Data;
								bool flag25 = data2 != null && data2.Length > 1;
								if (flag25)
								{
									int num8 = width - 2 * this.leftRight + 1;
									bool flag26 = hslCurveItem2.Data.Length <= num8;
									PointF[] array4;
									if (flag26)
									{
										array4 = new PointF[hslCurveItem2.Data.Length];
										for (int num9 = 0; num9 < hslCurveItem2.Data.Length; num9++)
										{
											array4[num9].X = (float)(this.leftRight + num9);
											array4[num9].Y = SoftPainting.ComputePaintLocationY(hslCurveItem2.IsLeftFrame ? this.value_max_left : this.value_max_right, hslCurveItem2.IsLeftFrame ? this.value_min_left : this.value_min_right, height - this.upDowm - this.upDowm, hslCurveItem2.Data[num9]) + (float)this.upDowm;
										}
									}
									else
									{
										array4 = new PointF[num8];
										for (int num10 = 0; num10 < array4.Length; num10++)
										{
											array4[num10].X = (float)(this.leftRight + num10);
											array4[num10].Y = SoftPainting.ComputePaintLocationY(hslCurveItem2.IsLeftFrame ? this.value_max_left : this.value_max_right, hslCurveItem2.IsLeftFrame ? this.value_min_left : this.value_min_right, height - this.upDowm - this.upDowm, hslCurveItem2.Data[num10 + hslCurveItem2.Data.Length - num8]) + (float)this.upDowm;
										}
									}
									using (Pen pen2 = new Pen(hslCurveItem2.LineColor, hslCurveItem2.LineThickness))
									{
										graphics.DrawLines(pen2, array4);
									}
								}
							}
						}
					}
				}
			}
		}

		// Token: 0x06001E94 RID: 7828 RVA: 0x00093D58 File Offset: 0x00091F58
		private bool IsNeedPaintDash(float paintValue)
		{
			for (int i = 0; i < this.auxiliary_lines.Count; i++)
			{
				bool flag = Math.Abs(this.auxiliary_lines[i].PaintValue - paintValue) < (float)this.font_size9.Height;
				if (flag)
				{
					return false;
				}
			}
			return true;
		}

		// Token: 0x06001E95 RID: 7829 RVA: 0x00093DB8 File Offset: 0x00091FB8
		private int CalculateDataCountByOffect(float offect)
		{
			bool flag = offect > 40f;
			int result;
			if (flag)
			{
				result = 1;
			}
			else
			{
				offect = 40f / offect;
				result = (int)Math.Ceiling((double)offect);
			}
			return result;
		}

		// Token: 0x06001E96 RID: 7830 RVA: 0x00093DEB File Offset: 0x00091FEB
		private void UserCurve_SizeChanged(object sender, EventArgs e)
		{
			base.Invalidate();
		}

		/// <summary> 
		/// 清理所有正在使用的资源。
		/// </summary>
		/// <param name="disposing">如果应释放托管资源，为 true；否则为 false。</param>
		// Token: 0x06001E97 RID: 7831 RVA: 0x00093DF8 File Offset: 0x00091FF8
		protected override void Dispose(bool disposing)
		{
			bool flag = disposing && this.components != null;
			if (flag)
			{
				this.components.Dispose();
			}
			base.Dispose(disposing);
		}

		/// <summary> 
		/// 设计器支持所需的方法 - 不要修改
		/// 使用代码编辑器修改此方法的内容。
		/// </summary>
		// Token: 0x06001E98 RID: 7832 RVA: 0x00093E30 File Offset: 0x00092030
		private void InitializeComponent()
		{
			base.SuspendLayout();
			base.AutoScaleDimensions = new SizeF(6f, 12f);
			base.AutoScaleMode = AutoScaleMode.Font;
			this.BackColor = Color.Transparent;
			base.Name = "UserCurve";
			base.Size = new Size(615, 296);
			base.SizeChanged += this.UserCurve_SizeChanged;
			base.Paint += this.UserCurve_Paint;
			base.ResumeLayout(false);
		}

		// Token: 0x040006B3 RID: 1715
		private const int value_count_max = 2048;

		// Token: 0x040006B4 RID: 1716
		private float value_max_left = 100f;

		// Token: 0x040006B5 RID: 1717
		private float value_min_left = 0f;

		// Token: 0x040006B6 RID: 1718
		private float value_max_right = 100f;

		// Token: 0x040006B7 RID: 1719
		private float value_min_right = 0f;

		// Token: 0x040006B8 RID: 1720
		private int value_Segment = 5;

		// Token: 0x040006B9 RID: 1721
		private bool value_IsAbscissaStrech = false;

		// Token: 0x040006BA RID: 1722
		private int value_StrechDataCountMax = 300;

		// Token: 0x040006BB RID: 1723
		private bool value_IsRenderDashLine = true;

		// Token: 0x040006BC RID: 1724
		private string textFormat = "HH:mm";

		// Token: 0x040006BD RID: 1725
		private int value_IntervalAbscissaText = 100;

		// Token: 0x040006BE RID: 1726
		private Random random = null;

		// Token: 0x040006BF RID: 1727
		private string value_title = "";

		// Token: 0x040006C0 RID: 1728
		private int leftRight = 50;

		// Token: 0x040006C1 RID: 1729
		private int upDowm = 25;

		// Token: 0x040006C2 RID: 1730
		private Dictionary<string, HslCurveItem> data_list = null;

		// Token: 0x040006C3 RID: 1731
		private string[] data_text = null;

		// Token: 0x040006C4 RID: 1732
		private List<AuxiliaryLine> auxiliary_lines;

		// Token: 0x040006C5 RID: 1733
		private Font font_size9 = null;

		// Token: 0x040006C6 RID: 1734
		private Font font_size12 = null;

		// Token: 0x040006C7 RID: 1735
		private Brush brush_deep = null;

		// Token: 0x040006C8 RID: 1736
		private Pen pen_normal = null;

		// Token: 0x040006C9 RID: 1737
		private Pen pen_dash = null;

		// Token: 0x040006CA RID: 1738
		private Color color_normal = Color.DeepPink;

		// Token: 0x040006CB RID: 1739
		private Color color_deep = Color.DimGray;

		// Token: 0x040006CC RID: 1740
		private Color color_dash = Color.Gray;

		// Token: 0x040006CD RID: 1741
		private StringFormat format_left = null;

		// Token: 0x040006CE RID: 1742
		private StringFormat format_right = null;

		// Token: 0x040006CF RID: 1743
		private StringFormat format_center = null;

		/// <summary> 
		/// 必需的设计器变量。
		/// </summary>
		// Token: 0x040006D0 RID: 1744
		private IContainer components = null;
	}
}
